<template>
	<div>
		<!-- :visible.sync="$store.state.bbsInfoflag" -->
		<el-dialog :close-on-click-modal="flag" :show-close="flag" title="留言信息" :visible.sync="$store.state.bbsInfoflag"
		 width="30%" center>
			<span>
				<!-- ////////////////////// -->
				<el-form ref="form" label-width="80px">
					<el-form-item label="用户昵称" >
						<el-input v-model="userInfo.uname" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="留言时间">
						<el-input v-model="bbsInfo.bbstime" maxlength=5 @keyup.native="trim1()" style="width:40%" disabled></el-input> 天
					</el-form-item>
					<el-form-item label="留言id">
						<el-input v-model="bbsInfo.bbsid" maxlength=15 @keyup.native="trim()" style="width:40%" disabled></el-input> 元
					</el-form-item>
					<el-form-item label="是否确认查看">
						<el-switch v-model="bbsInfo.bbsstage"></el-switch>
					</el-form-item>
					<el-form-item label="员工身份">
						<el-switch v-model="bbsInfo.bbsstage"></el-switch>
					</el-form-item>
					<!-- 		  <el-form-item label="活动性质">
		    <el-checkbox-group v-model="mealInfo.mealtype">
		      <el-checkbox label="长期套餐" name=1></el-checkbox>
		      <el-checkbox label="短期套餐" name=2></el-checkbox>
		    </el-checkbox-group>
		  </el-form-item> -->
					<!-- 					<el-form-item label="活动性质">
						<el-radio v-model="mealInfo.mealtype" :label="lab1">长期套餐</el-radio>
						<el-radio v-model="mealInfo.mealtype" :label="lab2">短期套餐</el-radio>
					</el-form-item> -->
					<el-form-item label="留言内容内容">
						<el-input type="textarea" v-model="bbsInfo.bbsremark" maxlength=55></el-input>
					</el-form-item>
				</el-form>
				<!-- ////////////////////// -->
			</span>
			<span slot="footer" class="dialog-footer">
				<el-button type="danger" @click="mealflag1(false)">删除</el-button>
				<el-button @click="cancel()">取 消</el-button>
				<el-button type="primary" @click="bbsflag(false)">保存</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {
		request
	} from "network/request.js"
	export default {
		props: {
			empInfo:{
				"empid": 0,
				"empname": "string",
				"empremark": "string",
				"empstate": "string",
				"emptype": "string"
			}
		},
		data() {
			return {
				lab1: 1,
				lab2: 2,
				flag: false,
				flag2: true,
				bbstate2: "1"
			};
		},
		methods: {
			bbsflag(flag) {
				if (this.bbsInfo.bbsstage == true) {
					this.bbstate2 = "1";
				} else {
					this.bbstate2 = "0"
				}
				request({
					url: '/BbsInfo/Bbsinfo',
					method: 'patch',
					data: {
						// id:this.$store.state.mealid
						"bbsid": this.bbsInfo.bbsid,
						"bbsremark": this.bbsInfo.bbsremark,
						"bbsstage": this.bbstate2,
						"bbstime": this.bbsInfo.bbstime,
						"bbstype": this.bbsInfo.bbstype,
						"uid": this.bbsInfo.uid
					}
				}).then(res => {
					this.$store.commit("updateBbsInfoflag", false)
					this.$router.push("blank_emt")
				})
			},
			mealflag1(flag) {
				/*提醒用户是否删除*/
				this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					/*****************/
					if (this.bbsInfo.bbsstage == true) {
						this.bbstate2 = "1";
					} else {
						this.bbstate2 = "0"
					}
					request({
						url: '/BbsInfo/Bbsinfo',
						method: 'patch',
						data: {
							// id:this.$store.state.mealid
							"bbsid": this.bbsInfo.bbsid,
							"bbsremark": this.bbsInfo.bbsremark,
							"bbsstage": 2,
							"bbstime": this.bbsInfo.bbstime,
							"bbstype": this.bbsInfo.bbstype,
							"uid": this.bbsInfo.uid
						}
					}).then(res => {
				this.$store.commit("updateBbsInfoflag", false)
				this.$router.push("blank_emt")
						this.$router.push("blank_emt")
					})

					/*****************/
					this.$message({
						type: 'success',
						message: '删除成功!'
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});



				/*************************/

			},
			cancel() {
				this.$store.commit("updateBbsInfoflag", false)
				// this.$store.commit("updateMealid", 0)
			},
			onSubmit() {
				console.log('submit!');
			},
			trim() {
				this.mealInfo.mealmoney = this.mealInfo.mealmoney.replace(/[^0-9\.]/g, '')
				// console.log(this.form.name)
			},
		}
	};
</script>

<style>
</style>
